﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DAL; 

namespace BLL
{
    public class BLLNguoiDung
    {
        private string id;
        public string Id
        {
            get { return id; }
            set { id = value; }
        }

        private string ten;
        public string Ten
        {
            get { return ten; }
            set { ten = value; }
        }

        private string matkhau;
        public string Matkhau
        {
            get { return matkhau; }
            set { matkhau = value; }
        }

        private string phanquyen;
        public string Phanquyen
        {
            get { return phanquyen; }
            set { phanquyen = value; }
        }
        private string hoten;
        public string Hoten
        {
            get { return hoten; }
            set { hoten = value; }
        }

        private string email;
        public string Email
        {
            get { return email; }
            set { email = value; }
        }

        private string sodienthoai;
        public string Sodienthoai
        {
            get { return sodienthoai; }
            set { sodienthoai = value; }
        }

        private bool userxau;
        public bool UserXau
        {
            get { return userxau; }
            set { userxau = value; }
        }

        private string tienmat;
        public string Tienmat
        {
            get { return tienmat; }
            set { tienmat = value; }
        }
        public BLLNguoiDung()
        { 
        
        }

        public BLLNguoiDung(string _id)
        {
            Id = _id;
        }
        public BLLNguoiDung(string _id,string _taikhoan,string a)
        {
            Id = _id;
            Tienmat = _taikhoan;
        }
        public BLLNguoiDung(string _id, string _matkhau)
        {
            Id = _id;
            Matkhau = _matkhau;
        }
        public BLLNguoiDung(string _id,string _matkhau,string _phanquyen,string _hoten, string _email,string _sodienthoai,bool _userxau,string _tienmat)
        {
            Id = _id;
            Matkhau = _matkhau;
            Phanquyen = _phanquyen;
            Hoten = _hoten;
            Email = _email;
            Sodienthoai = _sodienthoai;
            UserXau = _userxau;
            Tienmat = _tienmat;
        }

        //kiem tra dang nhap
        public bool Checklogin
        { 
            get{return DALNguoiDung.Checklogin(this);}
        }
        //tra ve quyen
        public string checklogin_quyen
        {
            get { return DALNguoiDung.Checklogin_quyen(this); }
        }
        //check tai khoan
        public string CheckTaiKhoan
        {
            get { return DALNguoiDung.CheckTaiKhoan(this); }
        }
        //update tai khoan sau khi thanh toan mua hang
        public void UpdateTaiKhoan()
        {
            DALNguoiDung.UpdateTaiKhoan(this);
        }
        //dang ki nguoi dung moi
        public string Dangki()
        {
           return DALNguoiDung.DangKi(this);
        }
        //xoa' nguoi dung
        public void Delete()
        {
            DALNguoiDung.Delete(this);
        }
        //danh sach user 
        private List<BLLNguoiDung> Getall;
        public List<BLLNguoiDung> GetAll
        {
            get
            {
                if (Getall == null)
                {
                    return DALNguoiDung.Getall();
                }
                return Getall;
            }
        }


        //nguoi dung theo id
        private List<BLLNguoiDung> getbyId;
        public List<BLLNguoiDung> GetbyId
        {
            get 
            {
                if (getbyId == null)
                {
                    return DALNguoiDung.GetbyId(this);
                }
                return getbyId;
            }
        }
        //sua nguoi dung
        public void Update()
        {
            DALNguoiDung.Update(this);
        }
    }
}
